﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Compiled.Win8StartWPF
{
	/// <summary>
	/// Interaction logic for ShortcutPanel.xaml
	/// </summary>
	public partial class ShortcutPanel : UserControl
	{
		public ShortcutPanel() 
		{
			InitializeComponent();
		}

		public virtual void Add(IconButton NewItem)
		{
			NewItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
			Shortcuts.Children.Add(NewItem);
			NewItem.Clicked += Item_Clicked;
		}

		public virtual void Item_Clicked(IconButton sender)
		{
			onItemClicked(sender);
		}

		public delegate void ItemClickedEvent(ShortcutPanel sender, IconButton clickedItem);
		public event ItemClickedEvent ItemClicked;
		protected virtual void onItemClicked(IconButton clickedItem)
		{
			if (ItemClicked != null)
				ItemClicked(this,clickedItem);
		}

		protected virtual void Clear()
		{
			Shortcuts.Children.Clear();
		}
	}
}
